package com.gyc.demo.lambdas;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.function.Predicate;

/**
 * @author gyc
 * @date 2018/1/23
 */
public class Test1_1 {
    public static void main(String[] args){
        List<String> list = Arrays.asList("Java", "Scala", "C++", "Haskell", "Lisp");
        System.out.println("Languages which starts with J :");
        Predicate<String> predicate=(s)->s.startsWith("J");
        list.stream().filter(predicate).forEach(System.out::print);
        Collections.sort(list, String::compareTo);
        list.forEach(one->System.out.println(one));

    }
}
